#pragma once

#include <stdint.h>
#include <base/core/singleton.h>
#include "behaviac/behaviac.h"
#include "Common/CharacterDefine.h"

class CreatureCommonAI;

class BehaviacAIManager : public ManualSingleton < BehaviacAIManager >
{
	friend class ManualSingleton < BehaviacAIManager >;

public:
	BehaviacAIManager();
	virtual ~BehaviacAIManager();

public:
	bool UnInit();
	bool Update(uint64_t tick);

	bool Init(behaviac::Workspace::EFileFormat ff = behaviac::Workspace::EFF_cpp,
		const char* szFilePath = "./MonsterAI",
		const char* szExportMetaFile = "./MonsterAI/data/MonsterAI_Running.xml");
public:
	CreatureCommonAI* CreateAI(const std::string& AI, CharIDType cid);
	void	DeleteAI(CreatureCommonAI* pAI);
private:
	uint64_t		m_lastTick;
	uint32_t		m_frames;
};


#define g_MakeBehaviacAIMgr() (BehaviacAIManager::Instance())
#define g_GetBehaviacAIMgr()  (BehaviacAIManager::GetInstance())
#define g_DelBehaviacAIMgr()  (BehaviacAIManager::Destroy())
